#include <iostream>
using namespace std;

int main()
{
    int a = 0, b = 0;
    cin >> a >> b;
    int count = 0;
    for(int i=a; i<=b; i++)
    {
        int tmp = i;
        while(tmp)
        {
            if(tmp%10 == 2)
                count++;
            tmp /= 10;
        }
    }
    cout << count <<endl;
    return 0;
}
